<?php


namespace App\Admin\Requests\AdminUser;


use App\Commons\Utils\ExtValidationTool;
use App\Commons\Requests\BaseFormRequest;

class UserUpdateRequest extends BaseFormRequest {

    public function rules() {
        $mobileValidate = ExtValidationTool::phoneAndTelCheck('电话号码格式有误', 'mobile');
        return [
            'name'     => 'required|string|max:255',
            'email'    => 'required|email|unique:users,email,' . request()->route('id'),
            'mobile'   => 'string|max:20|' . $mobileValidate,
            'type'     => 'required|integer|in:1,2,3',
            'remark'   => 'string|max:255',
            'status'   => 'required|integer|in:0,1',
        ];
    }
}